import request from './request.js'

//根据id获取商品详情
export function getCommodity(id) {
	return request({
		url: '/commodity/detailsForApp/'+id,
		method: 'GET'
	})
}

export function getCartList() {
	return request({
		url: '/cart',
		method: 'GET'
	})
}

export function editCart(params) {
	return request({
		url: '/cart',
		method: 'PUT',
		params: params
	})
}

export function deleteCart(ids) {
	return request({
		url: '/cart/'+ids,
		method: 'DELETE',
	})
}
// 添加到购物车
export function addCart(params) {
	return request({
		url: '/cart',
		method: 'POST',
	
		params: params
	})
}

//根据条件获取商品列表
export function getCommodityList(params) {
	return request({
		//等商品多了需要修改属性
		url: '/commodity/forApp?examine=3&isGrounding=2&commodityCategoryId='+params.commodityCategoryId+"&recommend="+params.recommend+"&query="+params.query+"&page="+params.page+"&limit="+params.limit,
		method: 'GET'
	})
}